<!--
 * @Description: 
 * @Author: mmzhang
 * @Date: 2022-01-17 15:04:02
 * @LastEditTime: 2022-02-15 10:54:28
-->
<template>
  <div class="clue-channel">
    <dt-grid ref="table" :onFetch='onFetch' />
  </div>
</template>
<script>
  import clueColumn from './clueColumns'
  import channelMgr from '@/biz/channel/channel'
  export default {
    data() {
      return {}
    },
    mounted() {
      this.$refs.table.init(this, new clueColumn(this))
      this.$refs.table.fetch()
    },
    methods: {
      channelStatus(row) {
        let params = {
          id: row.id,
        }

        this.$Modal.confirm({
          title: '线索渠道',
          content: `是否${row.status == 1 ? '禁用' : '启用'}该线索渠道`,
          onOk: () => {
            channelMgr.changeStartOrOff(params).then((res) => {
              this.$Message.success('操作成功。')
              this.$refs.table.fetch()
            })
          },
          onCancel: () => {
            this.$Message.info('你取消了操作。')
          },
        })
      },
      onFetch() {
        return channelMgr.getClueChannelList({}).then((res) => {
          return res
        })
      }
    }
  }
</script>